```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>分布式锁实现方式详解 | 现代分布式系统设计</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #2d3748;
            line-height: 1.6;
        }
        .noto-serif {
            font-family: 'Noto Serif SC', serif;
        }
        .gradient-bg {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .highlight-box {
            background: linear-gradient(to right, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
            border-left: 4px solid #667eea;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="gradient-bg text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="noto-serif text-4xl md:text-5xl font-bold leading-tight mb-6">
                        分布式锁的现代实现方案
                    </h1>
                    <p class="text-xl mb-8 opacity-90">
                        探索分布式系统中确保数据一致性的关键技术
                    </p>
                    <div class="flex items-center">
                        <span class="bg-white text-purple-700 px-4 py-2 rounded-full text-sm font-semibold mr-4">
                            <i class="fas fa-lock mr-2"></i>分布式系统
                        </span>
                        <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full text-sm font-semibold">
                            <i class="fas fa-server mr-2"></i>高可用性
                        </span>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <div class="w-full max-w-md">
                        <div class="mermaid">
                            graph TD
                            A[分布式锁] --> B[数据库实现]
                            A --> C[Redis实现]
                            A --> D[Zookeeper实现]
                            A --> E[Etcd实现]
                            A --> F[Hazelcast实现]
                            B --> G[简单易用]
                            B --> H[性能较低]
                            C --> I[高性能]
                            C --> J[自动过期]
                            D --> K[强一致性]
                            D --> L[复杂]
                            E --> M[高可用]
                            E --> N[租约机制]
                            F --> O[易于集成]
                            F --> P[集群依赖]
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-6xl px-4 py-12">
        <!-- Introduction -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-lg p-8">
                <h2 class="noto-serif text-3xl font-bold text-gray-800 mb-6">
                    <i class="fas fa-key text-purple-500 mr-3"></i>
                    分布式锁的核心价值
                </h2>
                <p class="text-lg text-gray-700 mb-6">
                    在分布式系统中，当多个进程需要访问共享资源时，分布式锁提供了协调机制，确保在任何时刻只有一个进程可以访问该资源。正确的分布式锁实现需要满足互斥性、避免死锁、高可用性等关键特性。
                </p>
                <div class="highlight-box p-6 rounded-lg mb-6">
                    <h3 class="noto-serif text-xl font-semibold text-gray-800 mb-3">
                        <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                        关键特性
                    </h3>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                        <div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
                            <h4 class="font-semibold text-purple-600 mb-2">
                                <i class="fas fa-user-lock mr-2"></i>互斥性
                            </h4>
                            <p class="text-sm text-gray-600">
                                同一时刻只有一个客户端能持有锁
                            </p>
                        </div>
                        <div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
                            <h4 class="font-semibold text-purple-600 mb-2">
                                <i class="fas fa-clock mr-2"></i>超时释放
                            </h4>
                            <p class="text-sm text-gray-600">
                                防止死锁，锁能自动释放
                            </p>
                        </div>
                        <div class="bg-white p-4 rounded-lg shadow-lg shadow-purple-100 border border-purple-100">
                            <h4 class="font-semibold text-purple-600 mb-2">
                                <i class="fas fa-shield-alt mr-2"></i>高可用
                            </h4>
                            <p class="text-sm text-gray-600">
                                锁服务具备容错能力
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Implementation Methods -->
        <section>
            <h2 class="noto-serif text-3xl font-bold text-gray-800 mb-8">
                <i class="fas fa-code-branch text-purple-500 mr-3"></i>
                分布式锁实现方式
            </h2>

            <!-- Database Lock -->
            <div class="bg-white rounded-xl shadow-lg p-8 mb-10 transition-all duration-300 card-hover">
                <div class="flex flex-col md:flex-row">
                    <div class="md:w-1/3 mb-6 md:mb-0">
                        <div class="bg-purple-100 text-purple-800 rounded-lg p-6 h-full flex flex-col">
                            <div class="flex items-center mb-4">
                                <div class="bg-white p-3 rounded-full mr-4">
                                    <i class="fas fa-database text-purple-600 text-xl"></i>
                                </div>
                                <h3 class="noto-serif text-2xl font-bold">基于数据库</h3>
                            </div>
                            <p class="text-gray-700 mb-4 flex-grow">
                                利用数据库的事务特性和唯一索引实现的分布式锁方案，适合已有数据库环境的简单场景。
                            </p>
                            <div class="mt-auto">
                                <span class="inline-block bg-white text-purple-600 px-3 py-1 rounded-full text-xs font-semibold mr-2">#简单实现</span>
                                <span class="inline-block bg-white text-purple-600 px-3 py-1 rounded-full text-xs font-semibold">#强一致性</span>
                            </div>
                        </div>
                    </div>
                    <div class="md:w-2/3 md:pl-8">
                        <h4 class="noto-serif text-xl font-semibold text-gray-800 mb-4">
                            <i class="fas fa-list-ol text-purple-500 mr-2"></i>
                            实现步骤
                        </h4>
                        <ol class="list-decimal pl-5 space-y-3 text-gray-700 mb-6">
                            <li><span class="font-medium">创建锁表</span>：在数据库中创建一张表，用于存储锁的信息。例如，表中包含锁名称、锁状态和过期时间等字段。</li>
                            <li><span class="font-medium">获取锁</span>：插入一行记录（或更新现有记录），表示尝试获取锁。使用数据库事务确保操作的原子性。可以使用乐观锁机制（如使用版本号）来避免并发冲突。</li>
                            <li><span class="font-medium">释放锁</span>：删除或更新锁表中的记录，表示释放锁。使用事务确保锁的释放操作是安全的。</li>
                        </ol>
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div>
                                <h5 class="font-semibold text-green-600 mb-2">
                                    <i class="fas fa-check-circle mr-2"></i>优点
                                </h5>
                                <ul class="list-disc pl-5 text-sm text-gray-600">
                                    <li>与应用程序层面无关，可以使用现有的数据库系统</li>
                                </ul>
                            </div>
                            <div>
                                <h5 class="font-semibold text-red-600 mb-2">
                                    <i class="fas fa-exclamation-circle mr-2"></i>缺点
                                </h5>
                                <ul class="list-disc pl-5 text-sm text-gray-600">
                                    <li>性能较低，因为数据库操作的延迟可能会影响锁的效率</li>
                                    <li>可能导致数据库成为瓶颈</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Redis Lock -->
            <div class="bg-white rounded-xl shadow-lg p-8 mb-10 transition-all duration-300 card-hover">
                <div class="flex flex-col md:flex-row">
                    <div class="md:w-1/3 mb-6 md:mb-0">
                        <div class="bg-red-100 text-red-800 rounded-lg p-6 h-full flex flex-col">
                            <div class="flex items-center mb-4">
                                <div class="bg-white p-3 rounded-full mr-4">
                                    <i class="fab fa-redis text-red-600 text-xl"></i>
                                </div>
                                <h3 class="noto-serif text-2xl font-bold">基于Redis</h3>
                            </div>
                            <p class="text-gray-700 mb-4 flex-grow">
                                利用Redis的原子操作和过期特性实现的高性能分布式锁，适用于高并发场景。
                            </p>
                            <div class="mt-auto">
                                <span class="inline-block bg-white text-red-600 px-3 py-1 rounded-full text-xs font-semibold mr-2">#高性能</span>
                                <span class="inline-block bg-white text-red-600 px-3 py-1 rounded-full text-xs font-semibold">#自动过期</span>
                            </div>
                        </div>
                    </div>
                    <div class="md:w-2/3 md:pl-8">
                        <h4 class="noto-serif text-xl font-semibold text-gray-800 mb-4">
                            <i class="fas fa-list-ol text-red-500 mr-2"></i>
                            实现步骤
                        </h4>
                        <ol class="list-decimal pl-5 space-y-3 text-gray-700 mb-6">
                            <li><span class="font-medium">获取锁</span>：使用`SET key value NX PX timeout`命令，其中`NX`表示只有当键不存在时才设置成功，`PX timeout`设置锁的过期时间。锁的值通常是一个唯一标识符，确保锁的唯一性。</li>
                            <li><span class="font-medium">释放锁</span>：使用Lua脚本原子操作来确保释放锁的操作是安全的。检查锁的值是否匹配，然后删除锁。使用Lua脚本可以确保获取和释放锁的操作在一个原子操作中完成。</li>
                        </ol>
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div>
                                <h5 class="font-semibold text-green-600 mb-2">
                                    <i class="fas fa-check-circle mr-2"></i>优点
                                </h5>
                                <ul class="list-disc pl-5 text-sm text-gray-600">
                                    <li>Redis提供了高性能的原子操作，锁的获取和释放非常快</li>
                                    <li>支持设置锁的过期时间，防止死锁</li>
                                </ul>
                            </div>
                            <div>
                                <h5 class="font-semibold text-red-600 mb-2">
                                    <i class="fas fa-exclamation-circle mr-2"></i>缺点
                                </h5>
                                <ul class="list-disc pl-5 text-sm text-gray-600">
                                    <li>依赖于Redis服务的稳定性和可用性</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Zookeeper Lock -->
            <div class="bg-white rounded-xl shadow-lg p-8 mb-10 transition-all duration-300 card-hover">
                <div class="flex flex-col md:flex-row">
                    <div class="md:w-1/3 mb-6 md:mb-0">
                        <div class="bg-blue-100 text-blue-800 rounded-lg p-6 h-full flex flex-col">
                            <div class="flex items-center mb-4">
                                <div class="bg-white p-3 rounded-full mr-4">
                                    <i class="fas fa-tree text-blue-600 text-xl"></i>
                                </div>
                                <h3 class="noto-serif text-2xl font-bold">基于Zookeeper</h3>
                            </div>
                            <p class="text-gray-700 mb-4 flex-grow">
                                利用Zookeeper的临时顺序节点和事件监听机制实现的强一致性分布式锁，适用于对一致性要求高的场景。
                            </p>
                            <div class="mt-auto">
                                <span class="inline-block bg-white text-blue-600 px-3 py-1 rounded-full text-xs font-semibold mr-2">#强一致性</span>
                                <span class="inline-block bg-white text-blue-600 px-3 py-1 rounded-full text-xs font-semibold">#监听机制</span>
                            </div>
                        </div>
                    </div>
                    <div class="md:w-2/3 md:pl-8">
                        <h4 class="noto-serif text-xl font-semibold text-gray-800 mb-4">
                            <i class="fas fa-list-ol text-blue-500 mr-2"></i>
                            实现步骤
                        </h4>
                        <ol class="list-decimal pl-5 space-y-3 text-gray-700 mb-6">
                            <li><span class="font-medium">获取锁</span>：在Zookeeper中创建一个临时顺序节点。节点的顺序号用来确定锁的优先级。监听前一个节点的删除事件，当前一个节点被删除时，获取锁。</li>
                            <li><span class="font-medium">释放锁</span>：删除当前的临时顺序节点，Zookeeper会自动删除临时节点并触发事件。</li>
                        </ol>
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div>
                                <h5 class="font-semibold text-green-600 mb-2">
                                    <i class="fas fa-check-circle mr-2"></i>优点
                                </h5>
                                <ul class="list-disc pl-5 text-sm text-gray-600">
                                    <li>Zookeeper提供了强一致性和高可靠性</li>
                                    <li>适用于大规模分布式系统</li>
                                </ul>
                            </div>
                            <div>
                                <h5 class="font-semibold text-red-600 mb-2">
                                    <i class="fas fa-exclamation-circle mr-2"></i>缺点
                                </h5>
                                <ul class="list-disc pl-5 text-sm text-gray-600">
                                    <li>Zookeeper的复杂性较高，需要专门的运维支持</li>
                                    <li>性能可能受到Zookeeper集群的影响</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Etcd Lock -->
            <div class="bg-white rounded-xl shadow-lg p-8 mb-10 transition-all duration-300 card-hover">
                <div class="flex flex-col md:flex-row">
                    <div class="md:w-1/3 mb-6 md:mb-0">
                        <div class="bg-green-100 text-green-800 rounded-lg p-6 h-full flex flex-col">
                            <div class="flex items-center mb-4">
                                <div class="bg-white p-3 rounded-full mr-4">
                                    <i class="fas fa-project-diagram text-green-600 text-xl"></i>
                                </div>
                                <h3 class="noto-serif text-2xl font-bold">基于Etcd</h3>
                            </div>
                            <p class="text-gray-700 mb-4 flex-grow">
                                利用Etcd的事务机制和租约特性实现的分布式锁，适用于Kubernetes等现代分布式系统。
                            </p>
                            <div class="mt-auto">
                                <span class="inline-block bg-white text-green-600 px-3 py-1 rounded-full text-xs font-semibold mr-2">#高可用</span>
                                <span class="inline-block bg-white text-green-600 px-3 py-1 rounded-full text-xs font-semibold">#租约机制</span>
                            </div>
                        </div>
                    </div>
                    <div class="md:w-2/3 md:pl-8">
                        <h4 class="noto-serif text-xl font-semibold text-gray-800 mb-4">
                            <i class="fas fa-list-ol text-green-500 mr-2"></i>
                            实现步骤
                        </h4>
                        <ol class="list-decimal pl-5 space-y-3 text-gray-700 mb-6">
                            <li><span class="font-medium">获取锁</span>：使用Etcd的`put`操作设置锁的键值对，并设置租约。租约会自动过期，防止死锁。使用`compare-and-set`操作确保锁的唯一性。</li>
                            <li><span class="font-medium">释放锁</span>：释放租约，Etcd会自动删除锁的键值对。</li>
                        </ol>
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div>
                                <h5 class="font-semibold text-green-600 mb-2">
                                    <i class="fas fa-check-circle mr-2"></i>优点
                                </h5>
                                <ul class="list-disc pl-5 text-sm text-gray-600">
                                    <li>Etcd提供了强一致性和高可用性</li>
                                    <li>支持自动过期和动态调整租约</li>
                                </ul>
                            </div>
                            <div>
                                <h5 class="font-semibold text-red-600 mb-2">
                                    <i class="fas fa-exclamation-circle mr-2"></i>缺点
                                </h5>
                                <ul class="list-disc pl-5 text-sm text-gray-600">
                                    <li>需要管理Etcd集群，复杂度较高</li>
                                    <li>性能依赖于Etcd的配置和负载</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Hazelcast Lock -->
            <div class="bg-white rounded-xl shadow-lg p-8 transition-all duration-300 card-hover">
                <div class="flex flex-col md:flex-row">
                    <div class="md:w-1/3 mb-6 md:mb-0">
                        <div class="bg-orange-100 text-orange-800 rounded-lg p-6 h-full flex flex-col">
                            <div class="flex items-center mb-4">
                                <div class="bg-white p-3 rounded-full mr-4">
                                    <i class="fas fa-cubes text-orange-600 text-xl"></i>
                                </div>
                                <h3 class="noto-serif text-2xl font-bold">基于Hazelcast</h3>
                            </div>
                            <p class="text-gray-700 mb-4 flex-grow">
                                利用Hazelcast的分布式数据结构实现的锁，适合已使用Hazelcast作为分布式缓存或计算平台的系统。
                            </p>
                            <div class="mt-auto">
                                <span class="inline-block bg-white text-orange-600 px-3 py-1 rounded-full text-xs font-semibold mr-2">#易于集成</span>
                                <span class="inline-block bg-white text-orange-600 px-3 py-1 rounded-full text-xs font-semibold">#高性能</span>
                            </div>
                        </div>
                    </div>
                    <div class="md:w-2/3 md:pl-8">
                        <h4 class="noto-serif text-xl font-semibold text-gray-800 mb-4">
                            <i class="fas fa-list-ol text-orange-500 mr-2"></i>
                            实现步骤
                        </h4>
                        <ol class="list-decimal pl-5 space-y-3 text-gray-700 mb-6">
                            <li><span class="font-medium">获取锁</span>：使用Hazelcast的`ILock`接口提供的`lock`方法来获取锁。</li>
                            <li><span class="font-medium">释放锁</span>：使用`unlock`方法释放锁。</li>
                        </ol>
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div>
                                <h5 class="font-semibold text-green-600 mb-2">
                                    <i class="fas fa-check-circle mr-2"></i>优点
                                </h5>
                                <ul class="list-disc pl-5 text-sm text-gray-600">
                                    <li>Hazelcast提供了高性能和易用的分布式锁实现</li>
                                    <li>可以与Hazelcast的其他分布式数据结构配合使用</li>
                                </ul>
                            </div>
                            <div>
                                <h5 class="font-semibold text-red-600 mb-2">
                                    <i class="fas fa-exclamation-circle mr-2"></i>缺点
                                </h5>
                                <ul class="list-disc pl-5 text-sm text-gray-600">
                                    <li>依赖于Hazelcast的集群和配置</li>
                                    <li>性能可能受到Hazelcast集群的影响</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Comparison Table -->
        <section class="mt-16">
            <h2 class="noto-serif text-3xl font-bold text-gray-800 mb-8">
                <i class="fas fa-balance-scale text-purple-500 mr-3"></i>
                实现方案对比
            </h2>
            <div class="bg-white rounded-xl shadow-lg overflow-hidden">
                <table class="min-w-full divide-y divide-gray-200">
                    <thead class="bg-purple-50">
                        <tr>
                            <th scope="col" class="px-6 py-4 text-left text-xs font-semibold text-purple-700 uppercase tracking-wider">
                                方案
                            </th>
                            <th scope="col" class="px-6 py-4 text-left text-xs font-semibold text-purple-700 uppercase tracking-wider">
                                性能
                            </th>
                            <th scope="col" class="px-6 py-4 text-left text-xs font-semibold text-purple-700 uppercase tracking-wider">
                                一致性
                            </th>
                            <th scope="col" class="px-6 py-4 text-left text-xs font-semibold text-purple-700 uppercase tracking-wider">
                                复杂度
                            </th>
                            <th scope="col" class="px-6 py-4 text-left text-xs font-semibold text-purple-700 uppercase tracking-wider">
                                适用场景
                            </th>
                        </tr>
                    </thead>
                    <tbody class="bg-white divide-y divide-gray-200">
                        <tr class="hover:bg-gray-50 transition-colors">
                            <td class="px-6 py-4 whitespace-nowrap font-medium text-purple-600">
                                <i class="fas fa-database mr-2"></i>数据库
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                <div class="flex items-center">
                                    <span class="w-16 text-right mr-2">低</span>
                                    <div class="w-32 bg-gray-200 rounded-full h-2">
                                        <div class="bg-red-400 h-2 rounded-full" style="width: 30%"></div>
                                    </div>
                                </div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                强一致
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                低
                            </td>
                            <td class="px-6 py-4 text-sm text-gray-500">
                                简单应用，低并发
                            </td>
                        </tr>
                        <tr class="hover:bg-gray-50 transition-colors">
                            <td class="px-6 py-4 whitespace-nowrap font-medium text-red-600">
                                <i class="fab fa-redis mr-2"></i>Redis
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                <div class="flex items-center">
                                    <span class="w-16 text-right mr-2">高</span>
                                    <div class="w-32 bg-gray-200 rounded-full h-2">
                                        <div class="bg-green-400 h-2 rounded-full" style="width: 90%"></div>
                                    </div>
                                </div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                最终一致
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                中
                            </td>
                            <td class="px-6 py-4 text-sm text-gray-500">
                                高并发，性能优先
                            </td>
                        </tr>
                        <tr class="hover:bg-gray-50 transition-colors">
                            <td class="px-6 py-4 whitespace-nowrap font-medium text-blue-600">
                                <i class="fas fa-tree mr-2"></i>Zookeeper
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                <div class="flex items-center">
                                    <span class="w-16 text-right mr-2">中</span>
                                    <div class="w-32 bg-gray-200 rounded-full h-2">
                                        <div class="bg-yellow-400 h-2 rounded-full" style="width: 60%"></div>
                                    </div>
                                </div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                强一致
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                高
                            </td>
                            <td class="px-6 py-4 text-sm text-gray-500">
                                一致性要求高
                            </td>
                        </tr>
                        <tr class="hover:bg-gray-50 transition-colors">
                            <td class="px-6 py-4 whitespace-nowrap font-medium text-green-600">
                                <i class="fas fa-project-diagram mr-2"></i>Etcd
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                <div class="flex items-center">
                                    <span class="w-16 text-right mr-2">中高</span>
                                    <div class="w-32 bg-gray-200 rounded-full h-2">
                                        <div class="bg-blue-400 h-2 rounded-full" style="width: 75%"></div>
                                    </div>
                                </div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                强一致
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                高
                            </td>
                            <td class="px-6 py-4 text-sm text-gray-500">
                                Kubernetes环境
                            </td>
                        </tr>
                        <tr class="hover:bg-gray-50 transition-colors">
                            <td class="px-6 py-4 whitespace-nowrap font-medium text-orange-600">
                                <i class="fas fa-cubes mr-2"></i>Hazelcast
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                <div class="flex items-center">
                                    <span class="w-16 text-right mr-2">高</span>
                                    <div class="w-32 bg-gray-200 rounded-full h-2">
                                        <div class="bg-green-400 h-2 rounded-full" style="width: 85%"></div>
                                    </div>
                                </div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                最终一致
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                中
                            </td>
                            <td class="px-6 py-4 text-sm text-gray-500">
                                已使用Hazelcast
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </section>

        <!-- Decision Guide -->
        <section class="mt-16">
            <h2 class="noto-serif text-3xl font-bold text-gray-800 mb-8">
                <i class="fas fa-question-circle text-purple-500 mr-3"></i>
                如何选择合适的分布式锁？
            </h2>
            <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                <div class="bg-white p-6 rounded-xl shadow-md transition-all duration-300 hover:shadow-lg">
                    <div class="text-purple-500 mb-4">
                        <i class="fas fa-bolt text-3xl"></i>
                    </div>
                    <h3 class="noto-serif text-xl font-semibold mb-3">性能需求</h3>
                    <p class="text-gray-700">
                        如果对性能要求极高，Redis或Hazelcast可能是更好的选择。它们提供了更高的吞吐量和更低的延迟。
                    </p>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-md transition-all duration-300 hover:shadow-lg">
                    <div class="text-purple-500 mb-4">
                        <i class="fas fa-shield-alt text-3xl"></i>
                    </div>
                    <h3 class="noto-serif text-xl font-semibold mb-3">一致性要求</h3>
                    <p class="text-gray-700">
                        如果业务对强一致性要求严格，Zookeeper或Etcd提供了更强的保证，但可能会牺牲一些性能。
                    </p>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-md transition-all duration-300 hover:shadow-lg">
                    <div class="text-purple-500 mb-4">
                        <i class="fas fa-cogs text-3xl"></i>
                    </div>
                    <h3 class="noto-serif text-xl font-semibold mb-3">现有基础设施</h3>
                    <p class="text-gray-700">
                        如果系统已经使用了某种中间件(如Redis、Zookeeper等)，优先考虑基于该中间件的实现，减少技术复杂度。
                    </p>
                </div>
            </div>
        </section>
    </main>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true
            }
        });
    </script>
</body>
</html>
```